<?php
/* @var $this CmpPunishController */
/* @var $model CmpPunish */
/* @var $form CActiveForm */
$this->breadcrumbs=array(
	'综合控制台'=>array($this->pre_module_url.'/index/index'),
	'客户服务'=>array($this->pre_module_url.'/cmpServices/admin'),
	'违规管理'=>array($this->pre_module_url.'/cmpPunish/admin'),
	'违规设置'=>array($this->pre_module_url.'/cmpPunish//punishSet'),
);
//违规类型
$reason = CmpPunish::model()->getZcuReason();
//违规处理
$result = CmpPunish::model()->getZcuResult();
?>


<?php $form=$this->beginWidget('CActiveForm', array(
	'id'=>'cmp-punish-form',
	'enableAjaxValidation'=>false,
)); ?>
	<ul class="form_list form_list2 mt10">
		<li class="title"><span class="fs_14 fw_b">违规设置</span></li>
		<li class="c_f"><span class="tit">违规总分数：</span>
			<div class="cont f_l"><?php echo CHtml::textField('Sumpoint',CmpPunish::model()->getSumpoint(),array('class'=>'t_ipt w_100','maxlength'=>10))?>分</div>
		</li>
		<li class="c_f"><span class="tit">选择违规类型：</span>
			<div class="cont f_l">
				<ul class="sub_li">
					<?php if(!empty($reason)){ foreach($reason as $key=>$val){?>
					<li>
						<input class="chk" type="checkbox" name="" />
						<?php echo CHtml::textField('Reason['.$key.'][title]',$val['title'],array('class'=>'t_ipt w_300'))?>
						扣<?php echo CHtml::textField('Reason['.$key.'][point]',$val['point'],array('class'=>'t_ipt w_80'))?>分
					</li>
					<?php }}?>
					<li><a class="c_06c add_setreason" href="javascript:" title="">新增设置</a></li>
				</ul>
			</div>
		</li>
		<li class="c_f"><span class="tit">违规处罚：</span>
			<div class="cont f_l">
				<ul class="sub_li">
				<?php if(!empty($result)){ foreach($result as $key=>$val){?>
					<li>
						<input class="chk" type="checkbox" name="Result[0][title]" />
						<?php echo CHtml::textField('Result['.$key.'][title]',$val['title'],array('class'=>'t_ipt w_300'))?>
						累计 <?php echo CHtml::textField('Result['.$key.'][point]',$val['point'],array('class'=>'t_ipt w_80'))?>分
					</li>
				<?php }}?>	
					<li><a class="c_06c add_setresult" href="javascript:" title="">新增设置</a></li>
				</ul>
			</div>
		</li>
		<li class="c_f"><span class="tit">&nbsp;</span>
			<div class="cont f_l">
				<?php echo CHtml::submitButton(Yii::t('adm','Save Date'),array('class'=>'mem_btn mem_btn20 mr5'))?>
				<?php echo CHtml::resetButton(Yii::t('adm','Reset'),array('class'=>'mem_btn mem_btn07'))?>
			</div>
		</li>
	</ul>	

<?php $this->endWidget(); ?>

<script type="text/javascript">
var sumreason = <?php echo empty($reason)?'0':count($reason);?>;
var sumresult = <?php echo empty($result)?'0':count($result);?>;
//增加设置类型
$('.add_setreason').bind('click',function addReason(){
	var str = '<li><input class="chk" type="checkbox" name="" /><input class="t_ipt w_300" type="text" name="Reason['+sumreason+'][title]" maxlength="50" value="发布总则中发布违禁信息第一项所列商品或信息的" />扣 <input class="t_ipt w_80" type="text" name="Reason['+sumreason+'][point]" maxlength="10" value="" />分</li>'; 
	$(this).parent().before(str);
	sumreason++;
});
//增加设置处罚
$('.add_setresult').bind('click',function addReason(){
	var str = '<li><input class="chk" type="checkbox" name="" /><input class="t_ipt w_300" type="text" name="Result['+sumresult+'][title]" maxlength="50" value="限制发布商品，且14天店铺屏蔽" />累计 <input class="t_ipt w_80" type="text" name="Result['+sumresult+'][point]" maxlength="10" value="" />分</li>'; 
	$(this).parent().before(str);
	sumresult++;
});

</script>
